<template>
  <view>
    <button @click="onLog()">console.log</button>
    <button @click="onDebug()">console.debug</button>
    <button @click="onInfo()">console.info</button>
    <button @click="onWarn()" type="warn">console.warn</button>
    <button @click="onError()" type="warn">console.error</button>
  </view>
</template>

<script>
export default {
  data() {
    return {
      title: '打印日志'
    };
  },
  methods: {
    onLog() {
      // 常规写法
      console.log("onLog()-->" + this.title);
      // clog
      console.log("clog");
      // clogv
      console.log('this.title: ', this.title);
      // 字符串拼接
      console.log('this.title: ' + this.title);
    },
    // 补充缺失的 onDebug 方法
    onDebug() {
      console.debug("this is debug log", this.title);
    },
    // 修正方法名（原 oninfo 改为驼峰式 onInfo）
    onInfo() {
      console.info("this is info log", this.title);
    },
    onWarn() {
      // 修正未定义的 name 变量，此处用示例值演示逻辑
      const name = 'test';
      if (name === 'zlm') {
        console.log("登录验证成功");
      } else {
        console.warn("this is warn log");
      }
    },
    onError() {
      console.error("this is error message");
    }
  }
};
</script>

<style>
button {
  margin: 15rpx;
  padding: 10rpx 20rpx;
}
</style>